﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using BD_projekt.MicroarraysDataSetTableAdapters;

namespace BD_projekt
{
    public static class DBConnection
    {
        public static MicroarraysDataSet FillDataSet()
        {
            MicroarraysDataSet set = new MicroarraysDataSet();

            try
            {
                ExperimentalFactorsTableAdapter expFacAdapter = new ExperimentalFactorsTableAdapter();
                expFacAdapter.Fill(set.ExperimentalFactors);

                ExperimentTypesTableAdapter expTypesAdapter = new ExperimentTypesTableAdapter();
                expTypesAdapter.Fill(set.ExperimentTypes);

                MicroarrayExpFactorsTableAdapter microExpFacAdapter = new MicroarrayExpFactorsTableAdapter();
                microExpFacAdapter.Fill(set.MicroarrayExpFactors);

                MicroarrayExpTypesTableAdapter microExpTypeAdapter = new MicroarrayExpTypesTableAdapter();
                microExpTypeAdapter.Fill(set.MicroarrayExpTypes);

                MicroarraySampleAttrTableAdapter microSampleAttrAdapter = new MicroarraySampleAttrTableAdapter();
                microSampleAttrAdapter.Fill(set.MicroarraySampleAttr);

                MicroarraySpeciesTableAdapter microSpeciesAdapter = new MicroarraySpeciesTableAdapter();
                microSpeciesAdapter.Fill(set.MicroarraySpecies);

                MicroarrayTableAdapter microAdapter = new MicroarrayTableAdapter();
                microAdapter.Fill(set.Microarray);

                MicroarrayVersionTableAdapter microVersionAdapter = new MicroarrayVersionTableAdapter();
                microVersionAdapter.Fill(set.MicroarrayVersion);

                SampleAttributesTableAdapter sampleAttrAdapter = new SampleAttributesTableAdapter();
                sampleAttrAdapter.Fill(set.SampleAttributes);

                SpeciesTableAdapter speciesAdapter = new SpeciesTableAdapter();
                speciesAdapter.Fill(set.Species);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return null;
            }
            return set;
        }
    }
}
